<#assign pojo=oneToManyPojo.getOne()>
<#assign many=oneToManyPojo.getMany()>
<#assign ones=oneToManyPojo.getOnes()>
<#assign fields=pojo.getFilterdPojoFields()>
<#assign declarationName = pojo.importType(pojo.getDeclarationName())>
<#assign declarationNameFirstLetterLower = pojo.importType(pojo.getDeclarationNameFirstLetterLower())>
<#assign realPackageAndClassPath = "${pojo.getRealPackageAndClassPath()}">
<#assign masterid = pojo.getDeclarationNameFirstLetterLower()+"Id">
'use strict';
app.controller('${declarationName}DetailController',
    function ($rootScope, $scope, $state, $stateParams, $location, SweetAlert, $filter, $resource,${declarationName}Service) {
        $scope.${declarationNameFirstLetterLower}Id = $stateParams.${declarationNameFirstLetterLower}Id;
        if ($scope.${declarationNameFirstLetterLower}Id == null) {
            $scope.${declarationNameFirstLetterLower}Id = $location.search().${declarationNameFirstLetterLower}Id
        }
        $scope.current${declarationName} = null;
        if ($scope.${declarationNameFirstLetterLower}Id) {
            ${declarationName}Service.get${declarationName}Detail($scope.${declarationNameFirstLetterLower}Id,function (result) {
                // console.log(result);
                $scope.current${declarationName} = result.data;
            });
        } else {
            // SweetAlert.swal({
            //     title: "纳税主体ID不能为空",
            //     confirmButtonColor: "#007AFF"
            // });
        }
        $scope.save${declarationName}=function(){
            ${declarationName}Service.save${declarationName}($scope.current${declarationName},function (result) {
                $scope.current${declarationName} = result.data;
            });
        }
        $scope.cancel${declarationName} = function () {
            // $rootScope.back();
            history.back();
        }
    });

